package com.muqi.app.qlearn.publish;

import com.muqi.app.qlearn.student.BaseFragmentActivity;
import com.muqi.app.qlearn.student.R;


import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioGroup;


public class WriteAuthorityActivity extends BaseFragmentActivity implements RadioGroup.OnCheckedChangeListener{
	public static final String SELECT_AUTHORITY_TYPE = "select_authority";
	private RadioGroup mAuthorRdg;
	private String resultType = "PUBLIC";
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.aty_select_authorization);
	}

	@Override
	protected void onInit() {
		mAuthorRdg = (RadioGroup) findViewById(R.id.author_radio_rdg);
		mAuthorRdg.setOnCheckedChangeListener(this);
	}

	@Override
	protected void onData() {
		// TODO Auto-generated method stub
	}
	
	public void onBack(View v){
		this.finish();
	}
	
	public void onDone(View v){
		Intent intent = new Intent();
		intent.putExtra(SELECT_AUTHORITY_TYPE, resultType);
		setResult(RESULT_OK, intent);
		finish();
	}

	@Override
	public void onCheckedChanged(RadioGroup group, int checkedId) {
		switch (checkedId) {
		case R.id.radiobtn_public:
			resultType = "PUBLIC";
			break;
		case R.id.radiobtn_class:
			resultType = "CLASS";
			break;
		case R.id.radiobtn_pravite:
			resultType = "PRIVATE";
			break;
		default:
			break;
		}
	}

}
